package com.innovation.chengzhangriji.ui.widget;

import android.content.Context;
import android.view.View;

public class TimelineVideoViewHolder extends TimelineViewHolder implements TimelineVideoView.OnClickVideoListener {

    public interface OnClickVideoListener {
        void onClickVideo(TimelineVideoViewHolder holder);
    }

    private OnClickVideoListener mOnClickVideoListener;

    private TimelineVideoView mVideo;

    public TimelineVideoViewHolder(Context context, View itemView) {
        super(context, itemView);
        mVideo = new TimelineVideoView(context);
        mVideo.setOnClickVideoListener(this);
        getContent().addView(mVideo);
    }

    @Override
    public void onClickVideo() {
        if (mOnClickVideoListener==null) {
            return;
        }
        mOnClickVideoListener.onClickVideo(this);
    }

    public void setOnClickVideoListener(OnClickVideoListener onClickVideoListener) {
        mOnClickVideoListener = onClickVideoListener;
    }

    public void setScreenshotUrl(String url) {
        mVideo.setScreenshotUrl(url);
    }

    public void setProgress(int progress){
        mVideo.setProgress(progress);
    }

    public void setProgressShow(boolean show) {
        mVideo.setProgressShow(show);
    }
}
